/*
    定义日志消息类，进行日志中间信息的存储：
        1. 日志输出时间
        2. 日志等级
        3. 源代码文件
        4. 源代码行号
        5. 线程ID
        6. 日志主体消息
        7. 日志器名称
*/
#pragma once
#include "Util.hpp"
#include "Level.hpp"
#include <thread>

// payload
namespace XKL
{
    struct LogMsg
    {
        using ptr = std::shared_ptr<LogMsg>;
        LogMsg(LogLevel::Value level, size_t line, 
               const std::string &filename, const std::string &logger, const std::string &payload)
            : _ctime(Util::Date::Current()), _level(level), _line(line),
              _tid(std::this_thread::get_id()), _payload(payload), _logger(logger), _filename(filename)
        {
        }

        time_t _ctime;
        LogLevel::Value _level;
        std::string _filename;
        size_t _line;
        std::thread::id _tid;
        std::string _payload;
        std::string _logger;
    };
}